//
//  WxMgr.m
//  iosapp
//
//  Created by chensentao on 2018/5/9.
//  Copyright © 2018年 macmini. All rights reserved.
//

#import "WxMgr.h"
#import "Constants.h"
#import "AppContext.h"

@interface WxMgr()
{
  
}

@end

@implementation WxMgr

#pragma mark - LifeCycle
+(instancetype)sharedWxMgr {
    static dispatch_once_t onceToken;
    static WxMgr *instance;
    dispatch_once(&onceToken, ^{
        instance = [[WxMgr alloc] init];
    });
    return instance;
}

- (instancetype)init
{
    self = [super init]; //用于初始化父类
    if (self) {
        // do something 在这里初始化支付相关项
       [WXApi registerApp:APP_ID];
    }
    return self;
}

-(BOOL) handleOpenURL:(NSURL *)url
{
    return [WXApi handleOpenURL:url delegate:self];
}


#pragma mark - WXApiDelegate
- (void)onResp:(BaseResp *)resp {
    if([resp isKindOfClass:[WXLaunchMiniProgramResp class]]){
        WXLaunchMiniProgramResp* res=(WXLaunchMiniProgramResp*)resp;
        [AppContext sharedContext].extMsg=res.extMsg;
    }
}

@end
